package com.zch.string_;

public class StringBuffer01 {
    public static void main(String[] args) {
        StringBuffer sb = new StringBuffer(); //创建一个大小为16的char[]，用于存放字符内容
        StringBuffer stringBuffer2 = new StringBuffer(100); //通过构造器指定char[]大小
        StringBuffer stringBuffer3 = new StringBuffer("hello"); //char[]大小是str.length + 16

        //String -> StringBuffer
        String str = "hello";
        sb.append(str); //对str没有影响

        //StringBuffer -> String
        String str2 = stringBuffer3.toString();
        String str3 = new String(stringBuffer3);
    }
}
